package com.mxpio.erp.common.handler;

import com.mxpio.erp.common.util.CloneUtil;
import com.mxpioframework.common.vo.Result;
import com.mxpioframework.system.service.PojoDictParseService;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Component
public class DictHandlerComponent {

    @Resource
    private PojoDictParseService dictService;

    public <T> T parseDict(T object, Class<T> clazz) {
        T t = CloneUtil.deepClone(object, clazz);
        Result<T> result = Result.OK(t);
        dictService.parseDictResult(result);
        return result.getResult();
    }

}
